package com.nbf.Collections;

/** Generic wrapper for any market data.<br>
 * Could be a price, or a marketcap, or some other factor<br>
 * It is hashed based on it's name
 * 
 * @author Zachary David
 *
 */
public class MarketVariable
{
	private final String _name;
	private final Double _value;
	
	public MarketVariable(String name, Double value)
	{
		_name = name;
		_value = value;
	}
	
	public String getName()
	{
		return _name;
	}
	
	public Double getValue()
	{
		return _value;
	}
	
	public int hashCode()
	{
		return _name.hashCode();
	}
	
	public boolean equals(Object obj)
	{
		if(obj == null)
			return false;
		
		if(this == obj)
			return true;
		
		if(obj instanceof String)
			return _name.equals((String)obj);
		
		return false;
	}
}
